package TimeToWork.Android;

import android.util.Log;

public abstract class Event {
    
    private static final String TAG = "Event";
    
    /* Overtime */
//    public static final int TYPE_OVERTIME_MONEY_A = 7;
//    public static final int TYPE_OVERTIME_MONEY_C = 8;
//    public static final int TYPE_OVERTIME_COMPENSATORY_A = 9;
//    public static final int TYPE_OVERTIME_COMPENSATORY_C = 10;
//    public static final int TYPE_OVERTIME_MONEY_ABROAD = 11; //A & C?
    
    private MyTime date;
    private int length;
    
    public Event(MyTime date, int length) {
        this.date = date;
        this.setLength(length);
    }
    
    public Event(int length) {
        this.setLength(length);
    }
    
    
    
    public MyTime getDate() {
        return this.date;
    }
    
    /**
     * Returns the lenght in minutes.
     * 
     * @return Length
     */
    public int getLength() {
        return length;
    }

    /**
     * @param length the length to set
     */
    public void setLength(int length) {
        /* Event length must be an increment of 30 minutes */
        if (length % 30 > 0) Log.e(TAG, "Illegal event length.");
        
        this.length = length;
    }
    
    public boolean inside (TimePeriod timePeriod) {
        return this.date.inside(timePeriod);
    }
    
}
